
function addImages(type){
	type=type||"design-planning";
	path="libraries/kcfinder/browse.php?lang=en&type="+type;
    openKCFinderMultiByPath(path,function(files){
        var Images=new Array();
        for (var i = 0; i < files.length; i++){
            Images[i]=files[i];
        }
        new backend({
            url: base_url+"backend/data/adddatas",
            data: {
                Images: Images,
                data_type:_CONFIG.TYPE,
                data_category:_CONFIG.CATE

            },
            callback: function(rsdata) {
                if (rsdata.result < 0) {
                    $.jGrowl(rsdata.message, {sticky: true, theme: 'growl-error', header: 'Error!'});
                    return false;
                } else {
                    oTable.fnDraw(false);
                    $.jGrowl(rsdata.message);
                    return true;
                }
            }
        }).call();
    });
}
function dataDelete(id){
    backend_delete(base_url+'backend/excution/delete/data/data/data',id,function(){
        oTable.fnDraw(false);
    });
}
function featuredPhotoEdit(Id){
	if ($('#_form_edit_panel').length == 1)
		return false;
	if (PENDING)
		return false;
	var kcgl = $('<div id=\'edit_item_with_popup\'>Loading...</div>');
	bootbox.dialog({
		//backdrop:true,
		animate: false,
		message: kcgl,
		title: "Featured Photo",
		buttons: {
			save: {
				label: "Save",
				className: "btn-success",
				callback: function() {
					if( $('#_form_edit_panel').validationEngine('validate') === false) return false;
					var Params = $('#_form_edit_panel').serializeObject();
					Params.data_type="feature";
					new backend({
						url: _CONFIG.COMMIT_FEATURE_URI,
						data: {
							Params: Params,
							Id: $('#data_id').val()
						},
						callback: function(rsdata) {
							if (rsdata.result < 0) {
								$.jGrowl(rsdata.message,{ sticky: true, theme: 'growl-error', header: 'Error!' });
								return false;
							} else {
								$.jGrowl(rsdata.message);
								$('#_form_edit_panel').parents('.bootbox').modal('hide');
								oTable.fnDraw(false);
								return true;
							}
						}
					}).call();
				}
			},
			cancel: {
				label: "Cancel",
				className: "btn-danger",
				callback: function() {

				}
			}
		}
	});
	new backend({
		url: _CONFIG.FEATURE_EDIT_PANEL_URI,
		data: {
			Id: Id
		},
		callback: function(rsdata) {
			PENDING = false;
			if (rsdata.result < 0) {
				$.jGrowl(rsdata.message,{ sticky: true, theme: 'growl-error', header: 'Error!' });
			} else {
				kcgl.html(rsdata.htmlreponse);
				$("#_form_edit_panel").validationEngine();
			}
		}
	}).call();
}
